import json

import requests  # 配置北向用户信息及北向地址nbi_name = "campus02@north.com"
from urllib3.exceptions import InsecureRequestWarning

from DjangoDemo.scripts.Http_Management import Http_Management
from DjangoDemo.scripts.Token import Token


class c2_2:
    # 默认深圳
    def __init__(self, the_user_mac_you_choose):
        self.token = Token()
        # 定义接口的 URI
        uri = "/rest/campusclientservice/v1/protocoltrace/sessionlist"

        jBody = '''{
            "intervals":"[3022-08-27T16:00:00.000Z/2022-08-28T06:52:21.000Z]",
            "level":"1",
            "tenantId":"default-organization-id",
            "id":"857b706e-67d9-49c0-b3cd-4bd1e6963c07",
            "accType":"1",
            "usermac":"%s"}''' % the_user_mac_you_choose

        self.r = Http_Management(self.token).post(uri, jBody)


if __name__ == '__main__':
    now = c2_2("Shenzhen")
    print(now.r.json())
